<!-- 我的视图 -->

<template>
  <div
    ref="view"
    v-bind="viewProps"
    @mousedown="mouseDown"
    @mouseup="mouseUp"
    @mousemove="mouseMove"
    @mousewheel="mouseWheel"
    @contextmenu.prevent="CORE.doNothing"
  >
    <ViewBackground cover @loaded="toLoaded">
      <ViewTrack :arr="trackList" />
    </ViewBackground>

    <ViewRuler />
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import MapView from '@admin/views/Secure/mixMap/MapView'

// ============================== 导出组件 ============================== //

export default CORE.extend(MapView, {
  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [...MapView.mixins, CORE.mixWeb()],

  /**
   * 组件导入 (Abc.vue + Abc/index.vue)
   */
  ...CORE.components(MapView.components, require.context('./', true, /vue$/)),

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    ...MapView.computed,

    /**
     * 轨迹列表
     */
    trackList() {
      const { list, map_list } = this
      return list.map((track) => {
        const point = map_list.find((item) => item.deviceId === track.pointId) || {}
        return { ...point, track }
      })
    },
  },
})
</script>

<style lang="scss">
@import '@admin/views/Secure/Patrol/PatrolGaode/MyMap/index.scss';
@import '@admin/views/Secure/Patrol/PatrolMap/MapView/index.scss';
</style>
